package com.chuangsi.project.admin.controller.app;


import com.chuangsi.framework.web.domain.ResultObject;
import com.chuangsi.project.admin.dto.app.index.*;
import com.chuangsi.project.admin.service.IIndexService;
import com.chuangsi.project.admin.service.IPayOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * APP首页统计 前端控制器
 * </p>
 *
 * @author ywb
 * @since 2025-02-25
 */
@Api(tags="APP-首页")
@RestController
@RequestMapping("/userApi/index")
public class AppIndexController {

    @Autowired
    private IIndexService indexService;

    @ApiOperation(value = "获取总销售", notes = "ywb")
    @GetMapping("/getTotalSales")
    public ResultObject<TotalSalesDto> getTotalSales() {
        TotalSalesDto totalSalesAmount = indexService.getTotalSales();
        return ResultObject.ok().setData(totalSalesAmount);
    }


    @ApiOperation(value = "获取今日/昨日销售金额", notes = "ywb")
    @GetMapping("/getDaySalesAmount")
    public ResultObject<DaySalesAmountDto> getDaySalesAmount() {
        DaySalesAmountDto salesAmount = indexService.getDaySalesAmount();
        return ResultObject.ok().setData(salesAmount);
    }

    @ApiOperation(value = "获取本周/上周的销售额折线图", notes = "ywb")
    @GetMapping("/getWeeKSalesAmount")
    public ResultObject<WeekSalesAmountDto> getWeeKSalesAmount() {
        List<WeekSalesAmountDto> salesAmount = indexService.getWeeKSalesAmount();
        return ResultObject.ok().setData(salesAmount);
    }

    @ApiOperation(value = "获取当月/上月销售金额", notes = "ywb")
    @GetMapping("/getMonthSalesAmount")
    public ResultObject<MonthSalesAmountDto> getMonthSalesAmount() {
        MonthSalesAmountDto salesAmount = indexService.getMonthSalesAmount();
        return ResultObject.ok().setData(salesAmount);
    }

    @ApiOperation(value = "获取本月销售产品占比（饼图）", notes = "ywb")
    @GetMapping("/getMonthSalesProductPieChart")
    public ResultObject<List<MonthSalesProductPieChartDto>> getMonthSalesProductPieChart() {
        List<MonthSalesProductPieChartDto> pirChart = indexService.getMonthSalesProductPieChart();
        return ResultObject.ok().setData(pirChart);
    }

    @ApiOperation(value = "获取本月销售公司占比（饼图）", notes = "ywb")
    @GetMapping("/getMonthSalesSealPieChart")
    public ResultObject<List<MonthSalesSealPieChartDto>> getMonthSalesSealPieChart() {
        List<MonthSalesSealPieChartDto> pirChart = indexService.getMonthSalesSealPieChart();
        return ResultObject.ok().setData(pirChart);
    }


    @ApiOperation(value = "获取本月计划完成情况（饼图）", notes = "ywb")
    @GetMapping("/getMonthSalesPlanPieChart")
    public ResultObject<MonthSalesPlanPieChartDto> getMonthSalesPlanPieChart() {
        MonthSalesPlanPieChartDto pirChart = indexService.getMonthSalesPlanPieChart();
        return ResultObject.ok().setData(pirChart);
    }



}
